package com.dfire.soa.mcsao.controller;

import com.dfire.soa.mcsao.IInterfaceAndAnnotationService;
import com.dfire.soa.mcsao.life.InitializingBeanService;
import com.dfire.soa.mcsao.life.SpringLifeCycle;
import com.dfire.soa.mcsao.service.InterfaceAndAnnotationService;
import com.dfire.soa.mcsao.life.PostUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created mangcao with 2019/1/18 9:47
 * Description:
 */
@RestController
@RequestMapping("life")
public class LifeController {

    @Resource
    private IInterfaceAndAnnotationService interfaceAndAnnotationService;

    @Resource(name = "interfaceAndAnnotationService")
    private   InterfaceAndAnnotationService interfaceAndAnnotationServiceV2;

    @Resource
    private PostUtil postUtil;

    @Resource
    private SpringLifeCycle springLifeCycle;

    @Resource
    InitializingBeanService initializingBeanService;

    @ResponseBody
    @RequestMapping("initializing_bean")
    public String initializingBeanService() {
        return initializingBeanService.get();
    }


    @ResponseBody
    @RequestMapping("post_util")
    public String postUtil() {
        return postUtil.PostUtil();
    }

    @ResponseBody
    @RequestMapping("spring_life_cycle")
    public String springLifeCycle() {
        return springLifeCycle.sayHall();
    }


    @ResponseBody
    @RequestMapping("interface_annotation")
    public String annotation() {
        return interfaceAndAnnotationService.getName();
    }

    @ResponseBody
    @RequestMapping("interface_annotation_v2")
    public String annotationV2() {
        return interfaceAndAnnotationServiceV2.getName();
    }



}
